import java.util.concurrent.*;

/**
 * @author Yin_JC
 * @PackageName:PACKAGE_NAME
 * @Class:ThreadPool
 * @Description:
 * @date 2020/3/3 6:40
 */

class Test1 implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i <100 ; i++) {
            System.out.println(Thread.currentThread().getName()+":"+i);
        }
    }
}

class Test2 implements Callable{
    private int number = 0;
    @Override
    public Object call() throws Exception {
        for (int i = 0; i < 100; i++) {
            number +=i;
        }
        return number;
    }
}

public class ThreadPool {
    public static void main(String[] args) {
        ExecutorService service = Executors.newFixedThreadPool(10);

        service.execute(new Test1());
//        service.submit(new Test2());
        System.out.println(service.getClass());
        service.shutdown();
    }
}
